﻿package mortal.game.view.guild.otherpanel
{
    import Message.DB.Tables.*;
    import __AS3__.vec.*;
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.pageSelect.*;
    import mortal.game.view.guild.cellrender.*;
    import mortal.mvc.interfaces.*;

    public class GuildPositonIntroducePanel extends GuildOtherBasePanel
    {
        private var _list:GTileList;
        private var _pageSelecter:PageSelecter;
        private static var _instance:GuildPositonIntroducePanel = null;
        private static const PAGE_CELL_COUNT:int = 10;

        public function GuildPositonIntroducePanel(param1:ILayer = null)
        {
            super(param1);
            setSize(474, 470);
            title = "" + Language.getString(71203);
            return;
        }// end function

        override public function layoutUI() : void
        {
            UIFactory.bg(16, 37, 452, 389, this);
            UIFactory.bg(16, 37, 452, 26, this, ImagesConst.RegionTitleBg);
            UIFactory.gTextField("" + Language.getString(71203), 18, 40, 54, 20, this);
            UIFactory.gTextField("" + Language.getString(71204), 102, 40, 70, 20, this);
            UIFactory.gTextField("" + Language.getString(71205), 175, 40, 65, 20, this);
            UIFactory.gTextField("" + Language.getString(71206), 257, 40, 40, 20, this);
            UIFactory.gTextField("" + Language.getString(71207), 365, 40, 54, 20, this);
            this._list = UIFactory.tileList(16, 64, 294, 210, this);
            this._list.rowHeight = 20;
            this._list.columnWidth = 304;
            this._list.horizontalGap = 1;
            this._list.verticalGap = 0.5;
            this._list.setStyle("cellRenderer", GuildPositionCellRenderer);
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = "center";
            this._pageSelecter = UIFactory.pageSelecter(100, 268, this, PageSelecter.CompleteMode);
            this._pageSelecter.setbgStlye(ImagesConst.ComboBg, _loc_1);
            this._pageSelecter.maxPage = 3;
            this._pageSelecter.currentPage = 1;
            this._pageSelecter.pageTextBoxSize = 45;
            this._pageSelecter.configEventListener(Event.CHANGE, this.onPageChange);
            var _loc_2:* = GlobalStyle.textFormatChen;
            _loc_2.size = 13;
            UIFactory.gTextField("" + Language.getString(71209), 36, 290, 60, 20, this, _loc_2);
            var _loc_3:* = GlobalStyle.textFormatPutong;
            var _loc_4:* = UIFactory.gTextField("" + Language.getString(71210), 36, 312, 60, 130, this, _loc_3);
            _loc_4.multiline = true;
            _loc_4.wordWrap = true;
            _loc_2 = GlobalStyle.textFormatShenHong;
            _loc_2.size = 13;
            UIFactory.gTextField("" + Language.getString(71211), 126, 290, 70, 20, this, _loc_2);
            var _loc_5:* = UIFactory.gTextField("" + Language.getString(71212), 126, 312, 60, 100, this, _loc_3);
            _loc_5.multiline = true;
            _loc_5.wordWrap = true;
            _loc_2 = GlobalStyle.textFormatItemBlue;
            _loc_2.size = 13;
            UIFactory.gTextField("" + Language.getString(71213), 216, 290, 60, 20, this, _loc_2);
            var _loc_6:* = UIFactory.gTextField("" + Language.getString(71214), 216, 312, 60, 100, this, _loc_3);
            _loc_6.multiline = true;
            _loc_6.wordWrap = true;
            var _loc_7:* = "<font size=\'12\' color=\'#FF5a00\'>" + Language.getString(71215) + "</font>" + "<font size=\'12\' color=\'#ffffff\'>" + Language.getString(71216) + "</font><br>" + "<font size=\'12\' color=\'#CC0066\'>" + Language.getString(71217) + "</font>" + "<font size=\'12\' color=\'#ffffff\'>" + Language.getString(71218) + "</font><br>" + "<font size=\'12\' color=\'#00BEFF\'>" + Language.getString(71219) + "</font>" + "<font size=\'12\' color=\'#ffffff\'>" + Language.getString(71220) + "</font><br>" + "<font size=\'12\' color=\'#00FF00\'>" + Language.getString(71221) + "</font>" + "<font size=\'12\' color=\'#ffffff\'>" + Language.getString(71222) + "</font>";
            var _loc_8:* = UIFactory.gTextField("", 300, 68, 162, 354, this, null, true);
            _loc_8.multiline = true;
            _loc_8.wordWrap = true;
            _loc_8.htmlText = _loc_7;
            return;
        }// end function

        private function onPageChange(event:Event) : void
        {
            this.update();
            return;
        }// end function

        override public function update() : void
        {
            var _loc_5:int = 0;
            var _loc_6:TGuildLevelTarget = null;
            if (!isLoadComplete)
            {
                return;
            }
            var _loc_1:* = GuildLevelTargetConfig.instance.getTargetList();
            this._pageSelecter.maxPage = _loc_1.length / PAGE_CELL_COUNT == 0 ? (1) : (Math.ceil(_loc_1.length / PAGE_CELL_COUNT));
            var _loc_2:* = (this._pageSelecter.currentPage - 1) * PAGE_CELL_COUNT;
            var _loc_3:* = new DataProvider();
            var _loc_4:int = 0;
            while (_loc_4 < PAGE_CELL_COUNT)
            {
                
                _loc_5 = _loc_2 + _loc_4;
                if (_loc_5 >= _loc_1.length)
                {
                    break;
                }
                _loc_6 = _loc_1[_loc_5];
                _loc_3.addItem(_loc_6);
                _loc_4++;
            }
            this._list.dataProvider = _loc_3;
            this._list.drawNow();
            return;
        }// end function

        public static function get instance() : GuildPositonIntroducePanel
        {
            if (!_instance)
            {
                _instance = new GuildPositonIntroducePanel;
            }
            return _instance;
        }// end function

    }
}
